#include "ScaleAnimation.h"
#include "GraphicalElement.h"

ScaleAnimation::ScaleAnimation(double toScale, unsigned long duration)
    : Animation(duration), toScale(toScale), currentScale(1)
{
}

ScaleAnimation::~ScaleAnimation()
{
}

void ScaleAnimation::update(double factor)
{
    currentScale = (1-factor) + factor * toScale;
}

void ScaleAnimation::render(const Position& parent)
{
    element->getTexture()->setScale(currentScale);
    Animation::render(parent);
}
